<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>浅拷贝</title>
</head>

<body>
  <script>
    // ============================== 浅拷贝方法 ==============================
    // 1. 对象拷贝
    const obj = {
      name: '佩奇'
    }

    // ============ Object.assign() ============
    const newObj = {}
    Object.assign(newObj , obj)
    newObj.name = '毛顺'
    console.log(newObj)
    console.log(obj)
    // ============ 展开运算符 ============
    // const newObj = {
    //   ...obj
    // }
    // console.log(newObj)
    // 2. 数组拷贝
    // const arr = ['佩奇', '乔治']

    // ============ concat 方法 ============


    // ============ 展开运算符 ============



    // 3. 浅拷贝的问题： 如果遇到多层对象还是会影响原来的对象
    // const pig = {
    //   name: '佩奇',
    //   family: {
    //     father: '猪爸爸'
    //   }
    // }
  </script>
</body>

</html>